import { Input, Button, Tooltip } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import { useAppDispatch } from "@/store";
import { set_is_show_dict_type_modal } from "@/store/slice/SysDict";
import { useState } from "react";
const { Search } = Input;

function DictTreeHeader() {
  const dispatch = useAppDispatch();
  const [searchValue, setSearchValue] = useState("");

  function handleAddDictTypeAddClick() {
    dispatch(
      set_is_show_dict_type_modal({
        show: true,
        mode: 1,
        title: "新增字典类型",
        data: {},
      })
    );
  }
  return (
    <>
      <div className="tree-header">
        <div className="tree-header-left">字典类型</div>
        <div className="tree-header-right">
          <Tooltip title="新增">
            <Button
              type="primary"
              size="small"
              shape="circle"
              icon={<PlusOutlined />}
              onClick={handleAddDictTypeAddClick}
            />
          </Tooltip>
        </div>
      </div>
      <Search
        allowClear
        style={{ marginBottom: 8 }}
        placeholder="Search"
        onChange={(e) => setSearchValue(e.target.value)}
      />
    </>
  );
}

export default DictTreeHeader;
